#region Microsoft Public License
/*
 * (c) Copyright Chenjun Wu. http://utablesdk.codeplex.com
 * 
 * This source is subject to the Microsoft Public License (Ms-PL).
 * Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
 * All other rights reserved.
 */
#endregion

﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Xml;

namespace UTable.Config
{
    class XmlConfigReader
    {
        public UTableConfig LoadConfig(String filePath)
        {
            try
            {
                DataContractSerializer serializer = new DataContractSerializer(typeof(UTableConfig));
                UTableConfig config = serializer.ReadObject(new XmlTextReader(filePath)) as UTableConfig;
                return config;
            }
            catch (System.Exception e)
            {
                Console.WriteLine("Can't load config file: " + filePath);
                Console.WriteLine(e.StackTrace);
                Console.WriteLine("The application is shut up!");
                return null;
            }
        }

    }
}
